package org.hypnus.e.tag;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.BodyTag;
import javax.servlet.jsp.tagext.BodyTagSupport;

import org.hypnus.e.sub.EContext;
import org.hypnus.e.sub.EDataset;
import org.hypnus.e.util.EConstants;
import org.hypnus.e.util.TagUtil;

public class DatasetTag extends BodyTagSupport {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private String name = EConstants.DEFAULT_DS;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Override
	public int doStartTag() throws JspException {
		EDataset dst = new EDataset() ;
		dst.setName(this.getName()) ;
		EContext cxt = TagUtil.getInstance().getEContext(pageContext) ;
		cxt.addDst(dst) ;
		pageContext.setAttribute(EConstants.DEFAULT_CXT, cxt) ;
		return BodyTag.EVAL_BODY_INCLUDE;
	}
	
	

}
